package com.hmall.common.clients;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.SearchDTO;
import com.hmall.common.pojo.Item;
import com.hmall.common.vo.SearchVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;



@FeignClient("itemservice")
@RequestMapping("/item")
public interface ItemClient {
    @GetMapping("/list")
    public PageDTO<Item> page(@RequestParam Integer page, @RequestParam Integer size);
    @PostMapping("/search/filters")
    public SearchVo searchFilters();

    @PostMapping("/search/list")
    public PageDTO<Item> searchList(@RequestBody SearchDTO dto);

    @GetMapping("/{id}")
    public Item getById(@PathVariable("id") Long id);
    @PutMapping("/stock/{itemId}/{num}")
    public void updateStock(@PathVariable("itemId") Long itemId,@PathVariable("num") Integer num);

    @PostMapping("/restock/{itemId}/{num}")
    public void restock(@PathVariable("itemId") Long itemId,@PathVariable("num") Integer num);

}
